package com.cory.boot.sys.mapper;

import java.io.Serializable;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.Mapper;
import com.cory.boot.sys.entity.SysParam;
import com.jarvis.cache.annotation.Cache;
import com.jarvis.cache.annotation.CacheDelete;
import com.jarvis.cache.annotation.CacheDeleteKey;


@Repository
public interface SysParamMapper extends Mapper<SysParam> {

    String CACHENAME = "SysParam:";
    int EXPIRETIME = 15 * 60;
    
    public List<SysParam> list(SysParam param);

    @Cache(expire = EXPIRETIME, key = "'" + CACHENAME + "'+#args[0]")
    SysParam selectById(Serializable id);
    
    @CacheDelete({@CacheDeleteKey(value = "'" + CACHENAME + "'+#args[0].paramName")})
    public int insert(SysParam param);

    @CacheDelete({@CacheDeleteKey(value = "'" + CACHENAME + "'+#args[0].paramName")})
    int updateById(@Param("et") SysParam param);

    @CacheDelete({@CacheDeleteKey(value = "'" + CACHENAME + "'+#args[0]")})
    int deleteById(@Param("paramName")Serializable id);
}
